(define (make-point x y)
    (cons x y)    
)
(define (x-point p)
    (car p)
)
(define (y-point p)
    (cdr p)
)
(define (print-point p)
    (newline)
    (display "(")
    (display (x-point p))
    (display ",")
    (display (y-point p))
    (display ")")
)

(define (make-rect top-left bottom-right)
    (cons top-left bottom-right)
)

(define (top-left rect1)
    (car rect1)
)
(define (bottom-right rect1)
    (cdr rect1)
)

(define (primeter rect1)
    (let (
            (tl (top-left rect1))
            (br (bottom-right rect1))
        )
        (*  2 
            (+  (abs (-  (x-point tl)
                    (x-point br))
                )
                (abs (- (y-point tl)
                    (y-point br))
                )         
            )
        )
    )
)

(define (area rect1)
    (let (
            (tl (top-left rect1))
            (br (bottom-right rect1))
        )
        (*   
            (abs (-  (x-point tl)
                    (x-point br))
            )
            (abs (- (y-point tl)
                    (y-point br))                         
            )
        )
    )
)

(define myrect
    (make-rect 
            (make-point 0 4)
            (make-point 5 0) 
    )
)
(display 
    (primeter myrect)   
)
(newline)
(display 
    (area myrect)   
)

(exit)